package com.superzlc.miniweb.servlet;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TestServlet /*extends MainServlet*/ {

	public TestServlet() {
	}

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		String str = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss").format(new Date());

		Runtime rt = Runtime.getRuntime();
		String s = "";
		System.out.println(rt.maxMemory() / 1024 / 1024);
		System.out.println(rt.totalMemory() / 1024 / 1024);
		System.out.println(rt.freeMemory() / 1024 / 1024);
		s += " maxMemory: " + rt.maxMemory() / 1024 / 1024;
		s += " totalMemory: " + rt.totalMemory() / 1024 / 1024;
		s += " freeMemory: " + rt.freeMemory() / 1024 / 1024;
		s += " ";

		response.getWriter().write(str + " test servlet " + s);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		String str = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss").format(new Date());
		response.getWriter().write(str + " test servlet");
	}

}
